import re
from typing import Any
from app.response.base_response import response_data


def parser_gdb_data(data: dict):

    print('GDB', data)
    answer = data.get('answer', '')
    if not answer:
        data['answer'] = ''
        return response_data('20001', '暂无答案,请重新输入问题', data)

    if not re.match(r'^[a-zA-Z]', answer):
        data['answer'] = ''
        return response_data('20001', '暂无答案,请重新输入问题', data)
    return response_data('20000', 'ok', data)


def parser_mysql_data(data: dict):

    print('MYSQL', data)
    answer = data.get('answer', '')
    if not answer:
        data['answer'] = ''
        return response_data('20001', '暂无答案,请重新输入问题', data)
    return response_data('20000', 'ok', data)
